SetXMLValue

Definition:

SetXMLValue(datasource, column, XPath, index, value)

 

Description:

Write a value into a specified element within an XML string stored in a specified column of a specified Data Source.

 

Platforms:

All

 

Parameters:

datasource - required

Specifies the Data Source to be acted on – click here for the format of this parameter.

 

column - required

Name of the column within the Data Source containing the XML.

 

XPath - required

XPath query to be used to extract elements from the XML string which you want to update. The query used should:

 

index - required

Number of the element you want to update within the set of elements returned by the XPath query. The first element has an index of 0.

Alternatively, to update all the retrieved elements, specify the index as -1.

 

value - required

The value to be written back to the element(s) specified by the index parameter above.

 

Returns:

0

Failure.

 

1

Success.

 

Notes:

  • This Method will retrieve the XML string from the specified Data Source column and extract the required element(s) from it using the specified XPath query.

    It then updates the element(s) specified by the index parameter with the value contained in the value parameter and, if the update is successful, writes the XML string back to the original column in the original Data Source. If you specify an index of -1 all the retrieved elements will be updated with the new value, otherwise only the specified element will be updated.

  • You cannot specify a Custom View as the Data Source for this Method nor can you use this Method if the Data Source is locked due to an ongoing asynchronous data transfer. You can use the IsDataSourceLocked Method to check whether the Data Source is locked.


See also:

GetXMLValue

ReadXMLValues

Synchronise

IsDataSourceLocked